package main

import (
	"fmt"
	"time"
)



func ticktimeget() uint32{
	t := time.Now().UnixNano()
	t /= (1000*1000)
	return uint32(t)
}

func app_get_systime() uint32{
	return ticktimeget()
}

func app_sleep(ptcnt *uint32, u_ms uint32){
	*ptcnt = app_get_systime() + u_ms
}


func app_pend_wake(tcnt uint32) bool{
	off := app_get_systime()- tcnt
	if(off>0 && off<0xff000000){
		return true
	}else{
		return false
	}
}


func main() {
	var tcnt1, tcnt2 uint32
	for true {
		if(app_pend_wake(tcnt1)){
			app_sleep(&tcnt1, 200);
			fmt.Println("run1")
		}
		if(app_pend_wake(tcnt2)){
			app_sleep(&tcnt2, 1000);
			fmt.Println("run2")
		}
		
		time.Sleep(10*time.Millisecond)
	}
	

	
}
